package com.learn.notice.controller;

import com.learn.model.Notice;
import com.learn.notice.service.NoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class NoticeController {
    @Autowired
    private NoticeService noticeService;
    
    @PostMapping("/addNotice")
    public String addDept(@RequestBody Notice notice) {
        return noticeService.addNotice(notice);
    }
    
    @PostMapping("/listNoticeByType")
    public List<Notice> findOneDept(Notice.NoticeType noticeType) {
        return noticeService.listNoticeByType(noticeType);
    }
    
    @PostMapping("/findAllNotice")
    public List<Notice> findAllNotice() {
        return noticeService.findAllNotice();
    }
}
